home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Hot Mix 17
/
Hot Mix 17.iso
/
HM17_SGI
/
research
/
examples
/
doc
/
sigprc10
< prev
next >
Wrap
Text File
|
1997-07-08
|
1KB
|
36 lines
; This batch file creates a plot a bandstop filter which suppresses
; frequencies between 7 cycles per second and 15 cycles per second for
; data sampled every 0.02 seconds. It is used in Chapter 13,
; "Signal Processing", of _Using IDL_.
delt = 0.02 ; sampling period in seconds
f_low = 15. ; frequencies above f_low will be passed
f_high = 7. ; frequencies below f_high will be passed
a_ripple = 50. ; ripple amplitude will be less than -50 dB
nterms = 40 ; the order of the filter
; Compute the impulse response = the filter coefficients
bs_ir_k = DIGITAL_FILTER(f_low*2*delt, f_high*2*delt, a_ripple, nterms)
; The frequency response of the filter is the FFT of its impulse response:
nfilt = N_ELEMENTS(bs_ir_k) ; nfilt = number of points in impulse response
bs_fr_k = FFT(bs_ir_k) * nfilt ; scale frequency response by number of pts
; log plot of magnitude in dB
f_filt = FINDGEN(nfilt/2+1) / (nfilt*delt)
mag = ABS(bs_fr_k(0:nfilt/2)) ; magnitude of bandstop filter transfer f'n
PLOT, f_filt, 20*ALOG10(mag), YTITLE='Magnitude in dB', $
XTITLE='Frequency in cycles / second', /XLOG, $
XRANGE=[1.0,1.0/(2.0*delt)], XSTYLE=1, $
TITLE='Frequency Response for Bandstop!CFIR Filter (Kaiser)'